# -*- coding = utf-8 -*-
# name   : 
# Author : admin
# Email  : 
# File   : config.py
# Ver    : 1.0
# Time   : 2025-07-15 09:27

from addon.configs.config_loader_json import config

# 当前环境
current_env = config.env

# 环境切换
isFormalSystem = True if config.env == "production" else False


def get_mongo_config(mongo_pre):
    mongo_pre = {  # 生产系统使用
        "URL": config.get(F"{mongo_pre}.URI"),  # 有此项则优先用此项进行数据库连接
        "HOST": config.get(F"{mongo_pre}.HOST"),
        "PORT": config.get(F"{mongo_pre}.PORT"),
        "AUTH": config.get(F"{mongo_pre}.AUTH"),  # AUTH 为 True 时需要进行 用户认证
        "USERNAME": config.get(F"{mongo_pre}.USERNAME"),
        "PASSWORD": config.get(F"{mongo_pre}.PASSWORD"),
        "DEFAULT_DB": config.get(F"{mongo_pre}.DEFAULT_DB")  # 默认数据库
    }

    return mongo_pre


# mongodb 数据库
MONGODB_CONF = get_mongo_config("MONGODB_CONF")  # 默认数据库
MONGODB_CONF_GYCC = get_mongo_config("MONGODB_CONF_GYCC")  # 桂银查查
MONGODB_CONF_WG = get_mongo_config("MONGODB_CONF_WG")  # 外管

if __name__ == '__main__':
    print(current_env)
    print(isFormalSystem)
    print(MONGODB_CONF)
    print(MONGODB_CONF_GYCC)
    print(MONGODB_CONF_WG)
